package jbpmguice.instantiation;

import org.jbpm.instantiation.XmlInstantiator;


public class GuiceXmlInstantiator extends XmlInstantiator {
    String configType = "xml";

    @SuppressWarnings({"rawtypes", "unchecked"})
    protected Object newInstance(Class clazz) {
        return GuiceConfigurationLoader.getConfigurationLoader().getInstance(clazz);
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        GuiceXmlInstantiator guiceXmlInstantiator = (GuiceXmlInstantiator) o;

        if (configType != null ? !configType.equals(guiceXmlInstantiator.configType) : guiceXmlInstantiator.configType != null)
            return false;

        return true;
    }

    @Override
    public int hashCode() {
        return configType != null ? configType.hashCode() : 0;
    }
}
